//checkbox全选
function allSelect(){
    var name=arguments[0]?arguments[0]:'id[]';
    $('input[name="'+name+'"]').attr('checked','true');
}
//checkbox全不选
function allUnSelect(){
   var name=arguments[0]?arguments[0]:'id[]';
   $('input[name="'+name+'"]').removeAttr('checked');
}
//checkbox返选
function InverSelect(){
    var name=arguments[0]?arguments[0]:'id[]';
    $('input[name="'+name+'"]').each(function(index){
        if($(this).attr("checked")){
            $(this).removeAttr('checked');
        }else{
            $(this).attr('checked','true');
        }
    });
}
/**
 * 批量提交所选checkbox的id进行异步提交并删除
 * id为0为多选
 */
function ajaxSubmitdeleteSelect(id,url){
    if(id==0){
        var ids=new Array();
        $('input[name="id[]"]').each(function(){
            if($(this).attr("checked"))
                ids.push($(this).val());
        });
        id=ids;
    }
    art.dialog({
                lock: true,
                background: '#600',
                opacity: 0.6,
                content: '确认删除？删除后无法恢复！！',
                icon: 'warning',
                ok:function(){
                    $.ajax({
                        type:"POST",
                        dataType:"json",
                        data:{"id[]":id},
                        url:url,
                        success:function(json) {
                            if(json.result>0){
                                location.reload();
                            }else{
                                art.dialog({icon:'error',content:'删除数据失败!',time:1});
                            }
                        }
                    });
                },
                cancel: function(){}
     });
}